﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;
using System.Collections.Generic;
using YQGL.DBUtility;//Please add references
namespace YQGL.DAL
{
    /// <summary>
    /// 数据访问类:DJ_QYXX
    /// </summary>
    public partial class DJ_QYXX
    {
        public DJ_QYXX()
        { }
        #region  BasicMethod
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string ZCH)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from DJ_QYXX");
            strSql.Append(" where ZCH=@ZCH ");
            SqlParameter[] parameters = {
					new SqlParameter("@ZCH", SqlDbType.VarChar,20)			};
            parameters[0].Value = ZCH;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(YQGL.Model.DJ_QYXX model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into DJ_QYXX(");
            strSql.Append("Qybm,ZZDM,Nsrmc,FDDBRMC,FRDHHM,SCJYDZ,JYDZ,TJRMC,TjrDH,DXHM,Email,QYDL_DM,QYLX_DM,QYLXMX_DM,SDYSX1_DM,SDYSX2_DM,SDYSX3_DM,SDYSX4_DM,SDYSX5_DM,NsrZT_DM,Nsrdzdah,QQHM,FZRMC,FZRDH,HZDJRQ,ZCH,ZCRQ,ZCZB,GZRMC,FGLDMC,ZRLDMC,JYFW,DHHM,CWFZRMC,CWFZRDH)");
            strSql.Append(" values (");
            strSql.Append("@Qybm,@ZZDM,@Nsrmc,@FDDBRMC,@FRDHHM,@SCJYDZ,@JYDZ,@TJRMC,@TjrDH,@DXHM,@Email,@QYDL_DM,@QYLX_DM,@QYLXMX_DM,@SDYSX1_DM,@SDYSX2_DM,@SDYSX3_DM,@SDYSX4_DM,@SDYSX5_DM,@NsrZT_DM,@Nsrdzdah,@QQHM,@FZRMC,@FZRDH,@HZDJRQ,@ZCH,@ZCRQ,@ZCZB,@GZRMC,@FGLDMC,@ZRLDMC,@JYFW,@DHHM,@CWFZRMC,@CWFZRDH)");
            SqlParameter[] parameters = {
					new SqlParameter("@Qybm", SqlDbType.VarChar,20),
					new SqlParameter("@ZZDM", SqlDbType.VarChar,20),
					new SqlParameter("@Nsrmc", SqlDbType.VarChar,80),
					new SqlParameter("@FDDBRMC", SqlDbType.VarChar,20),
					new SqlParameter("@FRDHHM", SqlDbType.VarChar,20),
					new SqlParameter("@SCJYDZ", SqlDbType.VarChar,80),
					new SqlParameter("@JYDZ", SqlDbType.VarChar,80),
					new SqlParameter("@TJRMC", SqlDbType.VarChar,20),
					new SqlParameter("@TjrDH", SqlDbType.VarChar,20),
					new SqlParameter("@DXHM", SqlDbType.VarChar,11),
					new SqlParameter("@Email", SqlDbType.VarChar,50),
					new SqlParameter("@QYDL_DM", SqlDbType.Char,2),
					new SqlParameter("@QYLX_DM", SqlDbType.Char,4),
					new SqlParameter("@QYLXMX_DM", SqlDbType.Char,6),
					new SqlParameter("@SDYSX1_DM", SqlDbType.Char,2),
					new SqlParameter("@SDYSX2_DM", SqlDbType.Char,2),
					new SqlParameter("@SDYSX3_DM", SqlDbType.Char,2),
					new SqlParameter("@SDYSX4_DM", SqlDbType.Char,2),
					new SqlParameter("@SDYSX5_DM", SqlDbType.Char,2),
					new SqlParameter("@NsrZT_DM", SqlDbType.Char,2),
					new SqlParameter("@Nsrdzdah", SqlDbType.VarChar,20),
					new SqlParameter("@QQHM", SqlDbType.VarChar,20),
					new SqlParameter("@FZRMC", SqlDbType.VarChar,20),
					new SqlParameter("@FZRDH", SqlDbType.VarChar,20),
					new SqlParameter("@HZDJRQ", SqlDbType.DateTime),
					new SqlParameter("@ZCH", SqlDbType.VarChar,20),
					new SqlParameter("@ZCRQ", SqlDbType.DateTime),
					new SqlParameter("@ZCZB", SqlDbType.Decimal,9),
					new SqlParameter("@GZRMC", SqlDbType.VarChar,20),
					new SqlParameter("@FGLDMC", SqlDbType.VarChar,20),
					new SqlParameter("@ZRLDMC", SqlDbType.VarChar,20),
					new SqlParameter("@JYFW", SqlDbType.VarChar,250),
					new SqlParameter("@DHHM", SqlDbType.VarChar,20),
					new SqlParameter("@CWFZRMC", SqlDbType.VarChar,20),
					new SqlParameter("@CWFZRDH", SqlDbType.VarChar,20)};
            parameters[0].Value = model.Qybm;
            parameters[1].Value = model.ZZDM;
            parameters[2].Value = model.Nsrmc;
            parameters[3].Value = model.FDDBRMC;
            parameters[4].Value = model.FRDHHM;
            parameters[5].Value = model.SCJYDZ;
            parameters[6].Value = model.JYDZ;
            parameters[7].Value = model.TJRMC;
            parameters[8].Value = model.TjrDH;
            parameters[9].Value = model.DXHM;
            parameters[10].Value = model.Email;
            parameters[11].Value = model.QYDL_DM;
            parameters[12].Value = model.QYLX_DM;
            parameters[13].Value = model.QYLXMX_DM;
            parameters[14].Value = model.SDYSX1_DM;
            parameters[15].Value = model.SDYSX2_DM;
            parameters[16].Value = model.SDYSX3_DM;
            parameters[17].Value = model.SDYSX4_DM;
            parameters[18].Value = model.SDYSX5_DM;
            parameters[19].Value = model.NsrZT_DM;
            parameters[20].Value = model.Nsrdzdah;
            parameters[21].Value = model.QQHM;
            parameters[22].Value = model.FZRMC;
            parameters[23].Value = model.FZRDH;
            parameters[24].Value = model.HZDJRQ;
            parameters[25].Value = model.ZCH;
            parameters[26].Value = model.ZCRQ;
            parameters[27].Value = model.ZCZB;
            parameters[28].Value = model.GZRMC;
            parameters[29].Value = model.FGLDMC;
            parameters[30].Value = model.ZRLDMC;
            parameters[31].Value = model.JYFW;
            parameters[32].Value = model.DHHM;
            parameters[33].Value = model.CWFZRMC;
            parameters[34].Value = model.CWFZRDH;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(YQGL.Model.DJ_QYXX model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update DJ_QYXX set ");
            strSql.Append("Qybm=@Qybm,");
            strSql.Append("ZZDM=@ZZDM,");
            strSql.Append("Nsrmc=@Nsrmc,");
            strSql.Append("FDDBRMC=@FDDBRMC,");
            strSql.Append("FRDHHM=@FRDHHM,");
            strSql.Append("SCJYDZ=@SCJYDZ,");
            strSql.Append("JYDZ=@JYDZ,");
            strSql.Append("TJRMC=@TJRMC,");
            strSql.Append("TjrDH=@TjrDH,");
            strSql.Append("DXHM=@DXHM,");
            strSql.Append("Email=@Email,");
            strSql.Append("QYDL_DM=@QYDL_DM,");
            strSql.Append("QYLX_DM=@QYLX_DM,");
            strSql.Append("QYLXMX_DM=@QYLXMX_DM,");
            strSql.Append("SDYSX1_DM=@SDYSX1_DM,");
            strSql.Append("SDYSX2_DM=@SDYSX2_DM,");
            strSql.Append("SDYSX3_DM=@SDYSX3_DM,");
            strSql.Append("SDYSX4_DM=@SDYSX4_DM,");
            strSql.Append("SDYSX5_DM=@SDYSX5_DM,");
            strSql.Append("NsrZT_DM=@NsrZT_DM,");
            strSql.Append("Nsrdzdah=@Nsrdzdah,");
            strSql.Append("QQHM=@QQHM,");
            strSql.Append("FZRMC=@FZRMC,");
            strSql.Append("FZRDH=@FZRDH,");
            strSql.Append("HZDJRQ=@HZDJRQ,");
            strSql.Append("ZCRQ=@ZCRQ,");
            strSql.Append("ZCZB=@ZCZB,");
            strSql.Append("GZRMC=@GZRMC,");
            strSql.Append("FGLDMC=@FGLDMC,");
            strSql.Append("ZRLDMC=@ZRLDMC,");
            strSql.Append("JYFW=@JYFW,");
            strSql.Append("DHHM=@DHHM,");
            strSql.Append("CWFZRMC=@CWFZRMC,");
            strSql.Append("CWFZRDH=@CWFZRDH");
            strSql.Append(" where ZCH=@ZCH ");
            SqlParameter[] parameters = {
					new SqlParameter("@Qybm", SqlDbType.VarChar,20),
					new SqlParameter("@ZZDM", SqlDbType.VarChar,20),
					new SqlParameter("@Nsrmc", SqlDbType.VarChar,80),
					new SqlParameter("@FDDBRMC", SqlDbType.VarChar,20),
					new SqlParameter("@FRDHHM", SqlDbType.VarChar,20),
					new SqlParameter("@SCJYDZ", SqlDbType.VarChar,80),
					new SqlParameter("@JYDZ", SqlDbType.VarChar,80),
					new SqlParameter("@TJRMC", SqlDbType.VarChar,20),
					new SqlParameter("@TjrDH", SqlDbType.VarChar,20),
					new SqlParameter("@DXHM", SqlDbType.VarChar,11),
					new SqlParameter("@Email", SqlDbType.VarChar,50),
					new SqlParameter("@QYDL_DM", SqlDbType.Char,2),
					new SqlParameter("@QYLX_DM", SqlDbType.Char,4),
					new SqlParameter("@QYLXMX_DM", SqlDbType.Char,6),
					new SqlParameter("@SDYSX1_DM", SqlDbType.Char,2),
					new SqlParameter("@SDYSX2_DM", SqlDbType.Char,2),
					new SqlParameter("@SDYSX3_DM", SqlDbType.Char,2),
					new SqlParameter("@SDYSX4_DM", SqlDbType.Char,2),
					new SqlParameter("@SDYSX5_DM", SqlDbType.Char,2),
					new SqlParameter("@NsrZT_DM", SqlDbType.Char,2),
					new SqlParameter("@Nsrdzdah", SqlDbType.VarChar,20),
					new SqlParameter("@QQHM", SqlDbType.VarChar,20),
					new SqlParameter("@FZRMC", SqlDbType.VarChar,20),
					new SqlParameter("@FZRDH", SqlDbType.VarChar,20),
					new SqlParameter("@HZDJRQ", SqlDbType.DateTime),
					new SqlParameter("@ZCRQ", SqlDbType.DateTime),
					new SqlParameter("@ZCZB", SqlDbType.Decimal,9),
					new SqlParameter("@GZRMC", SqlDbType.VarChar,20),
					new SqlParameter("@FGLDMC", SqlDbType.VarChar,20),
					new SqlParameter("@ZRLDMC", SqlDbType.VarChar,20),
					new SqlParameter("@JYFW", SqlDbType.VarChar,250),
					new SqlParameter("@DHHM", SqlDbType.VarChar,20),
					new SqlParameter("@CWFZRMC", SqlDbType.VarChar,20),
					new SqlParameter("@CWFZRDH", SqlDbType.VarChar,20),
					new SqlParameter("@ZCH", SqlDbType.VarChar,20)};
            parameters[0].Value = model.Qybm;
            parameters[1].Value = model.ZZDM;
            parameters[2].Value = model.Nsrmc;
            parameters[3].Value = model.FDDBRMC;
            parameters[4].Value = model.FRDHHM;
            parameters[5].Value = model.SCJYDZ;
            parameters[6].Value = model.JYDZ;
            parameters[7].Value = model.TJRMC;
            parameters[8].Value = model.TjrDH;
            parameters[9].Value = model.DXHM;
            parameters[10].Value = model.Email;
            parameters[11].Value = model.QYDL_DM;
            parameters[12].Value = model.QYLX_DM;
            parameters[13].Value = model.QYLXMX_DM;
            parameters[14].Value = model.SDYSX1_DM;
            parameters[15].Value = model.SDYSX2_DM;
            parameters[16].Value = model.SDYSX3_DM;
            parameters[17].Value = model.SDYSX4_DM;
            parameters[18].Value = model.SDYSX5_DM;
            parameters[19].Value = model.NsrZT_DM;
            parameters[20].Value = model.Nsrdzdah;
            parameters[21].Value = model.QQHM;
            parameters[22].Value = model.FZRMC;
            parameters[23].Value = model.FZRDH;
            parameters[24].Value = model.HZDJRQ;
            parameters[25].Value = model.ZCRQ;
            parameters[26].Value = model.ZCZB;
            parameters[27].Value = model.GZRMC;
            parameters[28].Value = model.FGLDMC;
            parameters[29].Value = model.ZRLDMC;
            parameters[30].Value = model.JYFW;
            parameters[31].Value = model.DHHM;
            parameters[32].Value = model.CWFZRMC;
            parameters[33].Value = model.CWFZRDH;
            parameters[34].Value = model.ZCH;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string ZCH)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from DJ_QYXX ");
            strSql.Append(" where ZCH=@ZCH ");
            SqlParameter[] parameters = {
					new SqlParameter("@ZCH", SqlDbType.VarChar,20)			};
            parameters[0].Value = ZCH;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string ZCHlist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from DJ_QYXX ");
            strSql.Append(" where ZCH in (" + ZCHlist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public YQGL.Model.DJ_QYXX GetModel(string ZCH)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 Qybm,ZZDM,Nsrmc,FDDBRMC,FRDHHM,SCJYDZ,JYDZ,TJRMC,TjrDH,DXHM,Email,QYDL_DM,QYLX_DM,QYLXMX_DM,SDYSX1_DM,SDYSX2_DM,SDYSX3_DM,SDYSX4_DM,SDYSX5_DM,NsrZT_DM,Nsrdzdah,QQHM,FZRMC,FZRDH,HZDJRQ,ZCH,ZCRQ,ZCZB,GZRMC,FGLDMC,ZRLDMC,JYFW,DHHM,CWFZRMC,CWFZRDH from DJ_QYXX ");
            strSql.Append(" where ZCH=@ZCH ");
            SqlParameter[] parameters = {
					new SqlParameter("@ZCH", SqlDbType.VarChar,20)			};
            parameters[0].Value = ZCH;

            YQGL.Model.DJ_QYXX model = new YQGL.Model.DJ_QYXX();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public YQGL.Model.DJ_QYXX DataRowToModel(DataRow row)
        {
            YQGL.Model.DJ_QYXX model = new YQGL.Model.DJ_QYXX();
            if (row != null)
            {
                if (row["Qybm"] != null)
                {
                    model.Qybm = row["Qybm"].ToString();
                }
                if (row["ZZDM"] != null)
                {
                    model.ZZDM = row["ZZDM"].ToString();
                }
                if (row["Nsrmc"] != null)
                {
                    model.Nsrmc = row["Nsrmc"].ToString();
                }
                if (row["FDDBRMC"] != null)
                {
                    model.FDDBRMC = row["FDDBRMC"].ToString();
                }
                if (row["FRDHHM"] != null)
                {
                    model.FRDHHM = row["FRDHHM"].ToString();
                }
                if (row["SCJYDZ"] != null)
                {
                    model.SCJYDZ = row["SCJYDZ"].ToString();
                }
                if (row["JYDZ"] != null)
                {
                    model.JYDZ = row["JYDZ"].ToString();
                }
                if (row["TJRMC"] != null)
                {
                    model.TJRMC = row["TJRMC"].ToString();
                }
                if (row["TjrDH"] != null)
                {
                    model.TjrDH = row["TjrDH"].ToString();
                }
                if (row["DXHM"] != null)
                {
                    model.DXHM = row["DXHM"].ToString();
                }
                if (row["Email"] != null)
                {
                    model.Email = row["Email"].ToString();
                }
                if (row["QYDL_DM"] != null)
                {
                    model.QYDL_DM = row["QYDL_DM"].ToString();
                }
                if (row["QYLX_DM"] != null)
                {
                    model.QYLX_DM = row["QYLX_DM"].ToString();
                }
                if (row["QYLXMX_DM"] != null)
                {
                    model.QYLXMX_DM = row["QYLXMX_DM"].ToString();
                }
                if (row["SDYSX1_DM"] != null)
                {
                    model.SDYSX1_DM = row["SDYSX1_DM"].ToString();
                }
                if (row["SDYSX2_DM"] != null)
                {
                    model.SDYSX2_DM = row["SDYSX2_DM"].ToString();
                }
                if (row["SDYSX3_DM"] != null)
                {
                    model.SDYSX3_DM = row["SDYSX3_DM"].ToString();
                }
                if (row["SDYSX4_DM"] != null)
                {
                    model.SDYSX4_DM = row["SDYSX4_DM"].ToString();
                }
                if (row["SDYSX5_DM"] != null)
                {
                    model.SDYSX5_DM = row["SDYSX5_DM"].ToString();
                }
                if (row["NsrZT_DM"] != null)
                {
                    model.NsrZT_DM = row["NsrZT_DM"].ToString();
                }
                if (row["Nsrdzdah"] != null)
                {
                    model.Nsrdzdah = row["Nsrdzdah"].ToString();
                }
                if (row["QQHM"] != null)
                {
                    model.QQHM = row["QQHM"].ToString();
                }
                if (row["FZRMC"] != null)
                {
                    model.FZRMC = row["FZRMC"].ToString();
                }
                if (row["FZRDH"] != null)
                {
                    model.FZRDH = row["FZRDH"].ToString();
                }
                if (row["HZDJRQ"] != null && row["HZDJRQ"].ToString() != "")
                {
                    model.HZDJRQ = DateTime.Parse(row["HZDJRQ"].ToString());
                }
                if (row["ZCH"] != null)
                {
                    model.ZCH = row["ZCH"].ToString();
                }
                if (row["ZCRQ"] != null && row["ZCRQ"].ToString() != "")
                {
                    model.ZCRQ = DateTime.Parse(row["ZCRQ"].ToString());
                }
                if (row["ZCZB"] != null && row["ZCZB"].ToString() != "")
                {
                    model.ZCZB = decimal.Parse(row["ZCZB"].ToString());
                }
                if (row["GZRMC"] != null)
                {
                    model.GZRMC = row["GZRMC"].ToString();
                }
                if (row["FGLDMC"] != null)
                {
                    model.FGLDMC = row["FGLDMC"].ToString();
                }
                if (row["ZRLDMC"] != null)
                {
                    model.ZRLDMC = row["ZRLDMC"].ToString();
                }
                if (row["JYFW"] != null)
                {
                    model.JYFW = row["JYFW"].ToString();
                }
                if (row["DHHM"] != null)
                {
                    model.DHHM = row["DHHM"].ToString();
                }
                if (row["CWFZRMC"] != null)
                {
                    model.CWFZRMC = row["CWFZRMC"].ToString();
                }
                if (row["CWFZRDH"] != null)
                {
                    model.CWFZRDH = row["CWFZRDH"].ToString();
                }
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select Qybm,ZZDM,Nsrmc,FDDBRMC,FRDHHM,SCJYDZ,JYDZ,TJRMC,TjrDH,DXHM,Email,QYDL_DM,QYLX_DM,QYLXMX_DM,SDYSX1_DM,SDYSX2_DM,SDYSX3_DM,SDYSX4_DM,SDYSX5_DM,NsrZT_DM,Nsrdzdah,QQHM,FZRMC,FZRDH,HZDJRQ,ZCH,ZCRQ,ZCZB,GZRMC,FGLDMC,ZRLDMC,JYFW,DHHM,CWFZRMC,CWFZRDH ");
            strSql.Append(" FROM DJ_QYXX ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" Qybm,ZZDM,Nsrmc,FDDBRMC,FRDHHM,SCJYDZ,JYDZ,TJRMC,TjrDH,DXHM,Email,QYDL_DM,QYLX_DM,QYLXMX_DM,SDYSX1_DM,SDYSX2_DM,SDYSX3_DM,SDYSX4_DM,SDYSX5_DM,NsrZT_DM,Nsrdzdah,QQHM,FZRMC,FZRDH,HZDJRQ,ZCH,ZCRQ,ZCZB,GZRMC,FGLDMC,ZRLDMC,JYFW,DHHM,CWFZRMC,CWFZRDH ");
            strSql.Append(" FROM DJ_QYXX ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) FROM DJ_QYXX ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.ZCH desc");
            }
            strSql.Append(")AS Row, T.*  from DJ_QYXX T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return DbHelperSQL.Query(strSql.ToString());
        }

        public DataSet GetListByQueryFull(Model.DJ_QYXX queryModel, out decimal total, int pageIndex, int pageSize, Dictionary<string, string> orderDicModel = null, StringBuilder strSqlWhere = null)
        {
            List<SqlParameter> sqlParameterList = new List<SqlParameter>();

            SqlParameter sqlParameterModel = new SqlParameter() { };

            PagerQuery query = new PagerQuery();
            query.PageIndex = pageIndex;
            query.PageSize = pageSize;
            query.PK = "ZCH";
            query.SelectClause = "  Qybm,ZZDM,Nsrmc,FDDBRMC,FRDHHM,SCJYDZ,JYDZ,TJRMC,TjrDH,DXHM,Email,QYDL_DM,QYLX_DM,QYLXMX_DM,SDYSX1_DM,SDYSX2_DM,SDYSX3_DM,SDYSX4_DM,SDYSX5_DM,NsrZT_DM,Nsrdzdah,QQHM,FZRMC,FZRDH,HZDJRQ,ZCH,ZCRQ,ZCZB,GZRMC,FGLDMC,ZRLDMC,JYFW,DHHM,CWFZRMC,CWFZRDH  ";
            query.FromClause = "DJ_QYXX";

            if (strSqlWhere == null)
            {
                strSqlWhere = new StringBuilder();
            }
            if (!string.IsNullOrEmpty(queryModel.Nsrmc))
            {
                strSqlWhere.Append(" AND ( Nsrmc like '%'+ @Nsrmc+'%' or  FDDBRMC like '%'+ @Nsrmc+'%'   )");
                SqlParameter sqlParameterModel1 = new SqlParameter("@Nsrmc", SqlDbType.NVarChar, 120);
                sqlParameterModel1.Value = queryModel.Nsrmc;
                sqlParameterList.Add(sqlParameterModel1);
            }

            query.WhereClause = strSqlWhere;
            StringBuilder strSqlOrder = new StringBuilder();


            if (orderDicModel != null)
            {
                int tmpIndex = 0;
                foreach (KeyValuePair<string, string> dicModel in orderDicModel)
                {
                    if (tmpIndex == 0)
                    {
                        strSqlOrder.Append(dicModel.Key + " " + (dicModel.Value == "0" ? "ASC" : "DESC"));
                    }
                    else
                    {
                        strSqlOrder.Append(" , " + dicModel.Key + " " + (dicModel.Value == "0" ? "ASC" : "DESC"));
                    }
                    tmpIndex++;
                }
            }
            else
            {
                strSqlOrder.Append("ZCH DESC");
            }
            query.SortClause = strSqlOrder.ToString();


            total = 0;

            //计算总数
            if (sqlParameterList.Count > 0)
            {
                object obj = DbHelperSQL.GetSingle(query.GenerateCountSql(), sqlParameterList.ToArray());
                if (obj != null)
                {
                    total = decimal.Parse(obj.ToString());
                }
            }
            else
            {
                object obj = DbHelperSQL.GetSingle(query.GenerateCountSql(), sqlParameterList.ToArray());
                if (obj != null)
                {
                    total = decimal.Parse(obj.ToString());
                }
            }

            //返回值
            if (sqlParameterList.Count > 0)
            {
                return DbHelperSQL.Query(query.GenerateSql(), sqlParameterList.ToArray());
            }
            else
            {
                return DbHelperSQL.Query(query.GenerateSql());
            }
        }
        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@tblName", SqlDbType.VarChar, 255),
                    new SqlParameter("@fldName", SqlDbType.VarChar, 255),
                    new SqlParameter("@PageSize", SqlDbType.Int),
                    new SqlParameter("@PageIndex", SqlDbType.Int),
                    new SqlParameter("@IsReCount", SqlDbType.Bit),
                    new SqlParameter("@OrderType", SqlDbType.Bit),
                    new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
                    };
            parameters[0].Value = "DJ_QYXX";
            parameters[1].Value = "ZCH";
            parameters[2].Value = PageSize;
            parameters[3].Value = PageIndex;
            parameters[4].Value = 0;
            parameters[5].Value = 0;
            parameters[6].Value = strWhere;	
            return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
        }*/

        #endregion  BasicMethod
        #region  ExtensionMethod

        #endregion  ExtensionMethod
    }
}

